Method: Float#>=
- Defined in:
- numeric.c
#>=(other) ⇒ Boolean
Returns true
if self
is numerically greater than or equal to other
:
2.0 >= 1 # => true
2.0 >= 1.0 # => true
2.0 >= Rational(1, 2) # => true
2.0 >= 2.0 # => true
2.0 >= 2.1 # => false
Float::NAN >= Float::NAN
returns an implementation-dependent value.
1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 |
# File 'numeric.c', line 1766
static VALUE
flo_ge(VALUE x, VALUE y)
{
double a, b;
a = RFLOAT_VALUE(x);
if (RB_TYPE_P(y, T_FIXNUM) || RB_BIGNUM_TYPE_P(y)) {
VALUE rel = rb_integer_float_cmp(y, x);
if (FIXNUM_P(rel))
return RBOOL(-FIX2LONG(rel) >= 0);
return Qfalse;
}
else if (RB_FLOAT_TYPE_P(y)) {
b = RFLOAT_VALUE(y);
#if MSC_VERSION_BEFORE(1300)
if (isnan(b)) return Qfalse;
#endif
}
else {
return rb_num_coerce_relop(x, y, idGE);
}
#if MSC_VERSION_BEFORE(1300)
if (isnan(a)) return Qfalse;
#endif
return RBOOL(a >= b);
}
|